package com.hfjy.bigdata.controller;

import com.hfjy.bigdata.bean.Goods;
import com.hfjy.bigdata.bean.SysUser;
import com.hfjy.bigdata.service.QuizService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/console/v1")
public class ConsoleController {
    @Autowired
    private QuizService quizService;

    /**
     * 学习中心获取大数据统计quiz
     *
     * @param page
     * @return
     */
    @RequestMapping("/getQuizes")
    public List<Goods> getQuizes(@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
        return quizService.getQuizs(page);
    }
    @RequestMapping("/test")
    public String index(@RequestParam(value = "page", required = false, defaultValue = "1") int page) {
        List<SysUser> list = new ArrayList<SysUser>();
        SysUser u1 = new SysUser(0001, "hello1", "11111111111111111");
        SysUser u2 = new SysUser(0002, "hello2", "22222222222222222");
        SysUser u3 = new SysUser(0003, "hello3", "33333333333333333");
        list.add(u1);
        list.add(u2);
        list.add(u3);
//        m.addAttribute("userList", list);
//        m.addAttribute("sysUser", "SysUser");
        return "views/index";
    }


}
